package com.huike.web.controller.report;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.huike.common.core.domain.AjaxResult;
import com.huike.report.service.IReportService;

@RestController
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private IReportService reportService;


    /**
     * 首页--基础数据统计
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
//    配置上权限 indexHome:baseQuery

    @GetMapping("/getBaseInfo")
    public AjaxResult getBaseInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime){
        return AjaxResult.success(reportService.getBaseInfo(beginCreateTime,endCreateTime));
    }

    /***
     * @Description： 首页--今日简报统计
     * @Author: guoxiang
     * @CreateTime: 2022/9/5 17:11
     * @return:com.huike.common.core.domain.AjaxResult
     * @Version: 1.0
     */

    @PreAuthorize("@ss.hasPermi('indexHome:baseQuery')")
    @GetMapping("/getTodayInfo")
    public AjaxResult getTodayInfo(){

        return AjaxResult.success(reportService.getTodayInfo());
    }

    /***
     * @Description： 首页-待办数据展示
     * @Author: guoxiang
     * @CreateTime: 2022/9/5 17:13
     * @return:com.huike.common.core.domain.AjaxResult
     * @Version: 1.0
     */

//    待完善--用户的权限问题-先实现接口--这次的获取就在线索表和商机表的状态获取把
    @GetMapping("/getTodoInfo")
    public AjaxResult getTodoInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime){

        return AjaxResult.success(reportService.getTodoInfo(beginCreateTime,endCreateTime));
    }

    /***
     * @Description： 龙虎榜
     * @Author: guoxiang
     * @CreateTime: 2022/9/6 15:35
     * @return:com.huike.common.core.domain.AjaxResult
     * @Version: 1.0
     */

    @GetMapping("/businessChangeStatistics")
    public AjaxResult businessChangeStatistics(String beginCreateTime,String endCreateTime){

        return AjaxResult.success(reportService.businessChangeStatistics(beginCreateTime,endCreateTime));
    }


//    线索龙虎榜
    @GetMapping("/salesStatistic")
    public AjaxResult salesStatistic(String beginCreateTime,String endCreateTime){

        return AjaxResult.success(reportService.businessChangeStatistics(beginCreateTime,endCreateTime));
    }

}